package com.polytech.dao;

import java.util.HashMap;

import com.polytech.beans.Car;
import com.polytech.beans.Client;

public class MemoryClientDao implements ClientDao {

	private HashMap< String,Client>clients=new HashMap<>();
	public MemoryClientDao() {
		insert(new Client("chakri","123"));
		insert(new Client("zero","123"));
		insert(new Client("alami","123"));
		insert(new Client("benchakroun","123"));
	}
	@Override
	public void insert(Client client) {
		clients.put(""+client.getEmail(), client);
	}
	@Override
	public Client select(String key) {
		return clients.get(key);
	}
	@Override
	public void remove(Client client) {
		if(clients.containsKey(client.getEmail()))
			clients.remove(client);
	}
	@Override
	public void update(Client client) {
		clients.put(""+client.getEmail(), client);
	}
}
